<?php

class DefaultController extends Controller
{
	public function actionIndex()
	{
		$this->render('index');
	}

    public function actionLogin(){
    	$this->layout = '//layouts/blank';
    	$this->bodyClass = "body-login";
		$model=new LoginForm;
		// collect user input data
		if(isset($_POST['LoginForm']))
		{
			$model->attributes=$_POST['LoginForm'];
			// validate user input and redirect to the previous page if valid
			if($model->validate() && $model->login())
				$this->redirect(Yii::app()->createUrl('home'));
		}
    	$this->render('login', array('model' => $model));
    }

    public function actionLogout(){
		Yii::app()->user->logout();
		$this->redirect(Yii::app()->createUrl('login.html'));
    }
}